
from django.db import models

# 通过类创建表


# 选课表
class SCInfo(models.Model):
    """
    选课表
    """
    # Sno = models.CharField(primary_key=True, max_length=5)  # 学号
    # Cno = models.IntegerField()  # 课程编号
    Grade = models.IntegerField(blank=True, null=True)  # 分数
    Sno = models.ForeignKey('student.StudentInfo', to_field='Sno', on_delete=models.CASCADE)  # 学号
    Cno = models.ForeignKey('course.ClassInfo', to_field='Cno', on_delete=models.CASCADE)

    class Meta:
        db_table = 'tb_sc'  # 自定义表名
        verbose_name = '选课'  # 这是一张用户表
        verbose_name_plural = verbose_name
